import request2 from '@/api/axios2';
import request_bkny from '@/api/axios_bkny'
/**
 * 根据企业查询配置项
 * @param {*} params 
 * @returns 
 */
const selectPage = (params) => {
    return request2({
        url: '/datacollectconfigure/pageList',
        method: 'get',
        params
    })
}
/**
 * 智能抄表
 * @param {*} params 
 * @returns 
 */
const treeProjDevice = (params) => {
    return request2({
        url: '/device/treeProjDevice',
        method: 'get',
        params
    })
}

const projectIdAndName = (params) =>{
    return request2({
        url: '/project/projectIdAndName',
        method: 'get',
        params
    })
}
/**
 * 查询公式列表
 * @param {社会信用代码} params 
 * @returns 
 */
const selectA = (params) =>{
    return request2({
        url: '/formula/select/a',
        method: 'post',
        params
    })
}
/**
 * 查询设备列表
 * @param {社会信用代码} params 
 * @returns 
 */
const selectB = (params) =>{
    return request2({
        url: '/formula/select/b',
        method: 'post',
        params
    })
}

const selectOne = (data)=>{
    return request2({
        url: '/formula/select/'+data.enterpriseCode+'/'+data.dataCode,
        method: 'post',
        data
    })
}
/**
 * 保存或者更新公式
 * @param {enterpriseCode:String,dataCode:String,operator:String,deviceIdList:String,formulaId:String } data 
 * @returns 
 */
const saveOrUpdate = (params)=>{
    return request2({
        url: '/formula/saveOrUpdate',
        method: 'post',
        params
    })
}
const deletefo = (params) =>{
    return request2({
        url: '/formula/delete/'+params.id,
        method: 'post',
        params
    })
}
/**
 * 获取用能单位产值、增加值、销售收入
 * @param {*} params 
 * @returns 
 */
const list9 = (params) =>{
    return request_bkny({
        url: '/bk/reg9/list2',
        method: 'post',
        params
    })
}
export {
    selectPage,
    treeProjDevice,
    projectIdAndName,
    selectA,
    selectOne,
    selectB,
    saveOrUpdate,
    deletefo,
    list9
}
